// ==UserScript==
// @name Bilibili Evolved (Preview)
// @description Bilibili Evolved 的预览版, 可以抢先体验新功能.
// @version 2.5.2
// @author Grant Howard, Coulomb-G
// @copyright 2022, Grant Howard (https://github.com/the1812) & Coulomb-G (https://github.com/Coulomb-G)
// @license MIT
// @match *://*.bilibili.com/*
// @exclude *://api.bilibili.com/*
// @exclude *://api.*.bilibili.com/*
// @exclude *://*.bilibili.com/api/*
// @exclude *://member.bilibili.com/studio/bs-editor/*
// @exclude *://t.bilibili.com/h5/dynamic/specification
// @exclude *://bbq.bilibili.com/*
// @exclude *://message.bilibili.com/pages/nav/header_sync
// @exclude *://s1.hdslb.com/bfs/seed/jinkela/short/cols/iframe.html
// @exclude *://open-live.bilibili.com/*
// @run-at document-start
// @grant unsafeWindow
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_deleteValue
// @grant GM_info
// @grant GM_xmlhttpRequest
// @connect raw.githubusercontent.com
// @connect github.com
// @connect cn.bing.com
// @connect www.bing.com
// @connect translate.google.cn
// @connect translate.google.com
// @connect localhost
// @connect *
// @require https://raw.githubusercontent.com/lodash/lodash/4.17.21/dist/lodash.min.js
// @icon https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo-small.png
// @icon64 https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/images/logo.png
// ==/UserScript==
/* eslint-disable */ /* spell-checker: disable */
// @[ You can find all source codes in GitHub repo ]
(()=>{var __webpack_modules__={2528:(e,t,n)=>{"use strict";n.r(t),n.d(t,{compatibilityPatch:()=>r});var i=n(2808),a=n(3437);
/* eslint-disable no-underscore-dangle */
const r=()=>{(0,i.contentLoaded)((async()=>{document.body.classList.add("round-corner");const{isIframe:e,matchUrlPattern:t}=await Promise.resolve().then(n.bind(n,7416));document.documentElement.classList.toggle("iframe",e()&&["https://t.bilibili.com/share/card/index","https://manga.bilibili.com/eden/bilibili-nav-panel.html","https://live.bilibili.com/blackboard/dropdown-menu.html","https://www.bilibili.com/page-proxy/game-nav.html"].some(t))})),(0,i.fullyLoaded)((()=>{(0,a.select)("meta[name=spm_prefix]").then((e=>{e&&(e.remove(),(0,a.select)((()=>unsafeWindow.__spm_prefix)).then((()=>{unsafeWindow.__spm_prefix&&delete unsafeWindow.__spm_prefix})))}))})),"undefined"==typeof requestIdleCallback&&(window.requestIdleCallback=e=>window.setTimeout(e,0),window.cancelIdleCallback=e=>{window.clearTimeout(e)})}},8346:(e,t,n)=>{"use strict";n.r(t),n.d(t,{initVue:()=>Is});var i=Object.freeze({});function a(e){return null==e}function r(e){return null!=e}function o(e){return!0===e}function s(e){return"string"==typeof e||"number"==typeof e||"symbol"==typeof e||"boolean"==typeof e}function l(e){return null!==e&&"object"==typeof e}var c=Object.prototype.toString;function d(e){return"[object Object]"===c.call(e)}function p(e){return"[object RegExp]"===c.call(e)}function u(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}function h(e){return r(e)&&"function"==typeof e.then&&"function"==typeof e.catch}function f(e){return null==e?"":Array.isArray(e)||d(e)&&e.toString===c?JSON.stringify(e,null,2):String(e)}function m(e){var t=parseFloat(e);return isNaN(t)?e:t}function g(e,t){for(var n=Object.create(null),i=e.split(","),a=0;a "+e+"{const[,t]=x(e);return await t},k=async(e,t)=>{const n=await e;if(0!==n.code){const e=new Error(`${t}: code = ${n.code}, message = ${n.message||n.msg}`);throw(0,i.logError)(e),e}return n.data||n.result||{}}},986:(e,t,n)=>{"use strict";n.r(t),n.d(t,{CdnTypes:()=>a,cdnRoots:()=>r});var i=n(6475);let a;!function(e){e.jsDelivr="jsDelivr",e.AltCdn="AltCdn",e.GitHub="GitHub"}(a||(a={}));const r={jsDelivr:(e,t)=>i.meta.compilationInfo.allCdns.jsDelivr.root(e,t),AltCdn:(e,t)=>i.meta.compilationInfo.altCdn.root(e,t),GitHub:(e,t)=>`https://raw.githubusercontent.com/${t||"the1812"}/Bilibili-Evolved/${e}/`}},3117:(e,t,n)=>{"use strict";n.r(t),n.d(t,{coreApis:()=>fi,externalApis:()=>mi});var i={};n.r(i),n.d(i,{enableHorizontalScroll:()=>O});var a={};n.r(a),n.d(a,{Reorder:()=>q,ReorderDecreaseClassName:()=>V,ReorderEnabledClassName:()=>N,ReorderIncreaseClassName:()=>B,ReorderOrientations:()=>F,ReorderingClassName:()=>j});var r={};n.r(r),n.d(r,{getUserInfo:()=>K});var o={};n.r(o),n.d(o,{loadDanmakuSettingsPanel:()=>ae,loadLazyPanel:()=>ne,loadLazyPlayerSettingsPanel:()=>ie,loadSubtitleSettingsPanel:()=>re});var s={};n.r(s),n.d(s,{styledComponentEntry:()=>me,toggleStyle:()=>ge});var l={};n.r(l),n.d(l,{getWatchlaterList:()=>we,toggleWatchlater:()=>xe,watchlaterList:()=>ye});var c={};n.r(c),n.d(c,{FeedsCardsManager:()=>Pe,FeedsCardsManagerEventType:()=>Me,addMenuItem:()=>et,applyContentFilter:()=>Ke,bangumiTypeList:()=>Se,createNodeValidator:()=>Oe,feedsCardCallbacks:()=>Ie,feedsCardTypes:()=>ke,feedsCardsManager:()=>Ue,forEachFeedsCard:()=>He,getFeeds:()=>Ye,getFeedsUrl:()=>Je,getVideoFeeds:()=>Qe,getVueData:()=>Te,groupVideoFeeds:()=>Ze,isPreOrderedVideo:()=>We,isRepostType:()=>Ce,isV2Feeds:()=>Re,navbarFeedsTypeList:()=>Ee,withContentFilter:()=>Xe});var d={};n.r(d),n.d(d,{DisableProfilePopupClass:()=>Lt,disableProfilePopup:()=>Dt,enableProfilePopup:()=>zt});var p={};n.r(p),n.d(p,{compareID:()=>Nt,getLatestID:()=>Bt,getNotifyCount:()=>Rt,isNewID:()=>Ft,setLatestID:()=>jt,updateInterval:()=>Vt,updateLatestID:()=>qt});var u={};n.r(u),n.d(u,{convertHexColorForDialogue:()=>Ht,convertHexColorForStyle:()=>Zt,convertTimeByDuration:()=>Gt,convertTimeByEndTime:()=>Kt,normalizeContent:()=>Xt});var h={};n.r(h),n.d(h,{escapeContent:()=>en,normalizeContent:()=>tn});var f={};n.r(f),n.d(f,{lightOff:()=>on,lightOn:()=>rn});var m={};n.r(m),n.d(m,{forEachVideoDanmaku:()=>cn});var g={};n.r(g),n.d(g,{BangumiInfo:()=>un,VideoInfo:()=>pn});var b={};n.r(b),n.d(b,{allQualities:()=>mn,loginRequiredQualities:()=>hn,vipRequiredQualities:()=>fn});var v={};n.r(v),n.d(v,{addMenuItem:()=>bn,forEachContextMenu:()=>gn});var y={};n.r(y),n.d(y,{addControlBarButton:()=>xn});var w={};n.r(w),n.d(w,{waitForControlBar:()=>_n});var x={};n.r(x),n.d(x,{LiveSocket:()=>In});var _={};n.r(_),n.d(_,{addMenuItem:()=>Rn,commentAreas:()=>Tn,forEachCommentArea:()=>Fn,forEachCommentItem:()=>qn});var k={};n.r(k),n.d(k,{addCategoryIcons:()=>Qn,categories:()=>Xn,categoryCodes:()=>Jn,categoryLinks:()=>Yn,rawData:()=>Hn});var C={};n.r(C),n.d(C,{createSwitchOptions:()=>li});var S=n(8911),E=n(986),A=n(3879),$=n(8368),I=n(3589),T=n(5405);const O=e=>{const t=t=>{t.deltaY&&!t.deltaX&&(t.preventDefault(),requestAnimationFrame((()=>{e.scrollBy(t.deltaY,0)})))};return e.addEventListener("wheel",t),e.style.scrollSnapType="none",()=>{e.removeEventListener("wheel",t),e.style.scrollSnapType=""}};var M=n(2808),P=n(6224),L=n(6475),D=n(4857);function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const V="reorder-decrease",B="reorder-increase",N="reorder-enabled",j="reordering",F={horizontal:{name:"horizontal",getMoveTransform:e=>`translateX(${e}px)`,setOtherTransform:lodash.throttle(((e,t,n)=>{if(!t.classList.contains(j))return;const i=e.find((e=>e.element===t));if(!i)return;const a=i.rect,r=e.filter((e=>e.rect.left.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*t+.7152*n+.0722*i),100*(.0193*t+.1192*n+.9505*i)]},o.rgb.lab=function(e){var t=o.rgb.xyz(e),n=t[0],i=t[1],a=t[2];return i/=100,a/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},o.hsl.rgb=function(e){var t,n,i,a,r,o=e[0]/360,s=e[1]/100,l=e[2]/100;if(0===s)return[r=255*l,r,r];t=2*l-(n=l<.5?l*(1+s):l+s-l*s),a=[0,0,0];for(var c=0;c<3;c++)(i=o+1/3*-(c-1))<0&&i++,i>1&&i--,r=6*i<1?t+6*(n-t)*i:2*i<1?n:3*i<2?t+(n-t)*(2/3-i)*6:t,a[c]=255*r;return a},o.hsl.hsv=function(e){var t=e[0],n=e[1]/100,i=e[2]/100,a=n,r=Math.max(i,.01);return n*=(i*=2)<=1?i:2-i,a*=r<=1?r:2-r,[t,100*(0===i?2*a/(r+a):2*n/(i+n)),100*((i+n)/2)]},o.hsv.rgb=function(e){var t=e[0]/60,n=e[1]/100,i=e[2]/100,a=Math.floor(t)%6,r=t-Math.floor(t),o=255*i*(1-n),s=255*i*(1-n*r),l=255*i*(1-n*(1-r));switch(i*=255,a){case 0:return[i,l,o];case 1:return[s,i,o];case 2:return[o,i,l];case 3:return[o,s,i];case 4:return[l,o,i];case 5:return[i,o,s]}},o.hsv.hsl=function(e){var t,n,i,a=e[0],r=e[1]/100,o=e[2]/100,s=Math.max(o,.01);return i=(2-r)*o,n=r*s,[a,100*(n=(n/=(t=(2-r)*s)<=1?t:2-t)||0),100*(i/=2)]},o.hwb.rgb=function(e){var t,n,i,a,r,o,s,l=e[0]/360,c=e[1]/100,d=e[2]/100,p=c+d;switch(p>1&&(c/=p,d/=p),i=6*l-(t=Math.floor(6*l)),0!=(1&t)&&(i=1-i),a=c+i*((n=1-d)-c),t){default:case 6:case 0:r=n,o=a,s=c;break;case 1:r=a,o=n,s=c;break;case 2:r=c,o=n,s=a;break;case 3:r=c,o=a,s=n;break;case 4:r=a,o=c,s=n;break;case 5:r=n,o=c,s=a}return[255*r,255*o,255*s]},o.cmyk.rgb=function(e){var t=e[0]/100,n=e[1]/100,i=e[2]/100,a=e[3]/100;return[255*(1-Math.min(1,t*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a)),255*(1-Math.min(1,i*(1-a)+a))]},o.xyz.rgb=function(e){var t,n,i,a=e[0]/100,r=e[1]/100,o=e[2]/100;return n=-.9689*a+1.8758*r+.0415*o,i=.0557*a+-.204*r+1.057*o,t=(t=3.2406*a+-1.5372*r+-.4986*o)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:12.92*i,[255*(t=Math.min(Math.max(0,t),1)),255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1))]},o.xyz.lab=function(e){var t=e[0],n=e[1],i=e[2];return n/=100,i/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(t-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},o.lab.xyz=function(e){var t,n,i,a=e[0];t=e[1]/500+(n=(a+16)/116),i=n-e[2]/200;var r=Math.pow(n,3),o=Math.pow(t,3),s=Math.pow(i,3);return n=r>.008856?r:(n-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,i=s>.008856?s:(i-16/116)/7.787,[t*=95.047,n*=100,i*=108.883]},o.lab.lch=function(e){var t,n=e[0],i=e[1],a=e[2];return(t=360*Math.atan2(a,i)/2/Math.PI)<0&&(t+=360),[n,Math.sqrt(i*i+a*a),t]},o.lch.lab=function(e){var t,n=e[0],i=e[1];return t=e[2]/360*2*Math.PI,[n,i*Math.cos(t),i*Math.sin(t)]},o.rgb.ansi16=function(e){var t=e[0],n=e[1],i=e[2],a=1 in arguments?arguments[1]:o.rgb.hsv(e)[2];if(0===(a=Math.round(a/50)))return 30;var r=30+(Math.round(i/255)<<2|Math.round(n/255)<<1|Math.round(t/255));return 2===a&&(r+=60),r},o.hsv.ansi16=function(e){return o.rgb.ansi16(o.hsv.rgb(e),e[2])},o.rgb.ansi256=function(e){var t=e[0],n=e[1],i=e[2];return t===n&&n===i?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},o.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var n=.5*(1+~~(e>50));return[(1&t)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},o.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var n;return e-=16,[Math.floor(e/36)/5*255,Math.floor((n=e%36)/6)/5*255,n%6/5*255]},o.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},o.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var n=t[0];3===t[0].length&&(n=n.split("").map((function(e){return e+e})).join(""));var i=parseInt(n,16);return[i>>16&255,i>>8&255,255&i]},o.rgb.hcg=function(e){var t,n=e[0]/255,i=e[1]/255,a=e[2]/255,r=Math.max(Math.max(n,i),a),o=Math.min(Math.min(n,i),a),s=r-o;return t=s<=0?0:r===n?(i-a)/s%6:r===i?2+(a-n)/s:4+(n-i)/s+4,t/=6,[360*(t%=1),100*s,100*(s<1?o/(1-s):0)]},o.hsl.hcg=function(e){var t=e[1]/100,n=e[2]/100,i=1,a=0;return(i=n<.5?2*t*n:2*t*(1-n))<1&&(a=(n-.5*i)/(1-i)),[e[0],100*i,100*a]},o.hsv.hcg=function(e){var t=e[1]/100,n=e[2]/100,i=t*n,a=0;return i<1&&(a=(n-i)/(1-i)),[e[0],100*i,100*a]},o.hcg.rgb=function(e){var t=e[0]/360,n=e[1]/100,i=e[2]/100;if(0===n)return[255*i,255*i,255*i];var a,r=[0,0,0],o=t%1*6,s=o%1,l=1-s;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=l,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=l,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=l}return a=(1-n)*i,[255*(n*r[0]+a),255*(n*r[1]+a),255*(n*r[2]+a)]},o.hcg.hsv=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t),i=0;return n>0&&(i=t/n),[e[0],100*i,100*n]},o.hcg.hsl=function(e){var t=e[1]/100,n=e[2]/100*(1-t)+.5*t,i=0;return n>0&&n<.5?i=t/(2*n):n>=.5&&n<1&&(i=t/(2*(1-n))),[e[0],100*i,100*n]},o.hcg.hwb=function(e){var t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],100*(n-t),100*(1-n)]},o.hwb.hcg=function(e){var t=e[1]/100,n=1-e[2]/100,i=n-t,a=0;return i<1&&(a=(n-i)/(1-i)),[e[0],100*i,100*a]},o.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},o.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},o.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},o.gray.hsl=o.gray.hsv=function(e){return[0,0,e[0]]},o.gray.hwb=function(e){return[0,100,e[0]]},o.gray.cmyk=function(e){return[0,0,0,e[0]]},o.gray.lab=function(e){return[e[0],0,0]},o.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n},o.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},2924:(e,t,n)=>{var i=n(3035),a=n(9745),r={};Object.keys(i).forEach((function(e){r[e]={},Object.defineProperty(r[e],"channels",{value:i[e].channels}),Object.defineProperty(r[e],"labels",{value:i[e].labels});var t=a(e);Object.keys(t).forEach((function(n){var i=t[n];r[e][n]=function(e){var t=function(t){if(null==t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var n=e(t);if("object"==typeof n)for(var i=n.length,a=0;a1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(i)}))})),e.exports=r},9745:(e,t,n)=>{var i=n(3035);function a(e){var t=function(){for(var e={},t=Object.keys(i),n=t.length,a=0;a
\n":"'+(n?e:ne(e,!0))+"
\n"},t.blockquote=function(e){return""+(n?e:ne(e,!0))+"
\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,n,i){return this.options.headerIds?"
\n":"
\n"},t.list=function(e,t,n){var i=t?"ol":"ul";return"<"+i+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+""+i+">\n"},t.listitem=function(e){return"\n\n"+e+"\n"+t+"
\n"},t.tablerow=function(e){return"\n"+e+" \n"},t.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+""+n+">\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+"
"},t.br=function(){return this.options.xhtml?"
":"
"},t.del=function(e){return""+e+""},t.link=function(e,t,n){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return n;var i='"+n+""},t.image=function(e,t,n){if(null===(e=te(this.options.sanitize,this.options.baseUrl,e)))return n;var i='":">"},t.text=function(e){return e},e}(),ae=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,n){return""+n},t.image=function(e,t,n){return""+n},t.br=function(){return""},e}(),re=function(){function e(){this.seen={}}var t=e.prototype;return t.serialize=function(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")},t.getNextSafeSlug=function(e,t){var n=e,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[e];do{n=e+"-"+ ++i}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=i,this.seen[n]=0),n},t.slug=function(e,t){void 0===t&&(t={});var n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)},e}(),oe=o.defaults,se=M.unescape,le=function(){function e(e){this.options=e||oe,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new ae,this.slugger=new re}e.parse=function(t,n){return new e(n).parse(t)},e.parseInline=function(t,n){return new e(n).parseInline(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var n,i,a,r,o,s,l,c,d,p,u,h,f,m,g,b,v,y,w="",x=e.length;for(n=0;n
"+pe(e.message+"",!0)+"";throw e}}return me.options=me.setOptions=function(e){return ce(me.defaults,e),he(me.defaults),me},me.getDefaults=ue,me.defaults=fe,me.use=function(e){var t=ce({},e);if(e.renderer&&function(){var n=me.defaults.renderer||new ie,i=function(t){var i=n[t];n[t]=function(){for(var a=arguments.length,r=new Array(a),o=0;oAn error occurred:
"+pe(e.message+"",!0)+"";throw e}},me.Parser=le,me.parser=le.parse,me.Renderer=ie,me.TextRenderer=ae,me.Lexer=Q,me.lexer=Q.lex,me.Tokenizer=j,me.Slugger=re,me.parse=me,me}()},5607:(e,t,n)=>{"use strict";var i=n(1144),a=Array.prototype.concat,r=Array.prototype.slice,o=e.exports=function(e){for(var t=[],n=0,o=e.length;n